﻿using Microsoft.AspNetCore.Authentication.Cookies;

namespace Novel.Server.Middleware
{
    public static class CookieAuthConfig
    {
        public static void ConfigureAuthentication(IServiceCollection services)
        {
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
                .AddCookie(options =>
                {
                    options.Cookie.HttpOnly = true;
                    options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
                    options.Cookie.SameSite = SameSiteMode.Strict;
                    options.Cookie.Name = "AuthCookie";
                    options.ExpireTimeSpan = TimeSpan.FromDays(7);
                });
        }
    }
}
